<?php

require_once dirname(dirname(__FILE__)) . '/config/config.php';

class lib_redirect {

//    public static function Redirect($redirect_link, $permanent = false) {
//        if (headers_sent() === false) {
//            header('Location: ' . LINK_ROOT . $redirect_link, true, ($permanent === true) ? 301 : 302);
//        }
//        exit();
//    }
//
//    public static function redirect_with_html($redirect_link) {
//        $redirect = "<script type='text/javascript'>window.location='" . LINK_ROOT . $redirect_link . "'</script>";
//        echo $redirect;
//    }

    public static function Redirect($url) {
        if (!headers_sent()) {
            header('Location: ' . LINK_ROOT . $url);
            exit;
        } else {
            echo '<script type="text/javascript">';
            echo 'window.location.href="' . LINK_ROOT . $url . '";';
            echo '</script>';
            echo '<noscript>';
            echo '<meta http-equiv="refresh" content="0;url=' . LINK_ROOT . $url . '" />';
            echo '</noscript>';
            exit;
        }
    }

}
